package com.wang.lottery.domain.activity.service.stateflow.event;

import com.wang.lottery.common.Constants;
import com.wang.lottery.common.Result;
import com.wang.lottery.domain.activity.service.stateflow.AbstractState;
import org.springframework.stereotype.Component;

/**
 * @author wjh
 * @create 2023-11-04 18:50
 * 通过
 */
@Component
public class PassState extends AbstractState {
    /**
     * 编辑
     *
     * @param activityId 活动id
     * @param stateId    当前状态
     * @return 审核结果
     */
    @Override
    public Result edit(Long activityId, Constants.ActivityState stateId) {
        return Result.buildResult(Constants.ResponseCode.UN_ERROR.getCode(), "活动状态变更失败");
    }

    /**
     * 提审
     *
     * @param activityId 活动id
     * @param stateId    当前状态
     * @return 审核结果
     */
    @Override
    public Result arraignment(Long activityId, Constants.ActivityState stateId) {
        return Result.buildResult(Constants.ResponseCode.UN_ERROR.getCode(), "活动状态变更失败");
    }

    /**
     * 审核通过
     *
     * @param activityId 活动id
     * @param stateId    当前状态
     * @return 审核结果
     */
    @Override
    public Result checkPass(Long activityId, Constants.ActivityState stateId) {
        return Result.buildResult(Constants.ResponseCode.UN_ERROR.getCode(), "活动状态变更失败");
    }

    /**
     * 审核拒绝
     *
     * @param activityId 活动id
     * @param stateId    当前状态
     * @return 审核结果
     */
    @Override
    public Result checkRefuse(Long activityId, Constants.ActivityState stateId) {
        return Result.buildResult(Constants.ResponseCode.UN_ERROR.getCode(), "活动状态变更失败");
    }

    /**
     * 撤销审核
     *
     * @param activityId 活动id
     * @param stateId    当前状态
     * @return 审核结果
     */
    @Override
    public Result checkRevoke(Long activityId, Constants.ActivityState stateId) {
        return Result.buildResult(Constants.ResponseCode.UN_ERROR.getCode(), "活动状态变更失败");
    }

    /**
     * 关闭
     *
     * @param activityId 活动id
     * @param stateId    当前状态
     * @return 审核结果
     */
    @Override
    public Result close(Long activityId, Constants.ActivityState stateId) {
        boolean status = super.activityRepository.alterStatus(activityId, stateId, Constants.ActivityState.CLOSE);
        return status ? Result.buildResult(Constants.ResponseCode.SUCCESS.getCode(), "活动已关闭") : Result.buildResult(Constants.ResponseCode.UN_ERROR.getCode(), "活动状态变更失败");

    }

    /**
     * 开启
     *
     * @param activityId 活动id
     * @param stateId    当前状态
     * @return 审核结果
     */
    @Override
    public Result open(Long activityId, Constants.ActivityState stateId) {
        return Result.buildResult(Constants.ResponseCode.UN_ERROR.getCode(), "活动状态变更失败");
    }

    /**
     * 运行活动中
     *
     * @param activityId 活动id
     * @param stateId    当前状态
     * @return 审核结果
     */
    @Override
    public Result doing(Long activityId, Constants.ActivityState stateId) {
        boolean status = super.activityRepository.alterStatus(activityId, stateId, Constants.ActivityState.DOING);
        return status ? Result.buildResult(Constants.ResponseCode.SUCCESS.getCode(), "活动执行成功") : Result.buildResult(Constants.ResponseCode.UN_ERROR.getCode(), "活动状态变更失败");

    }
}
